package com.lenovo.spider.component.duplicate;

import cn.hutool.core.collection.ConcurrentHashSet;
import com.lenovo.spider.component.TaskDuplicateChecker;
import com.lenovo.spider.domain.Task;

import java.util.Set;

/**
 * 任务重复检查器
 *
 * @author <a href="mailto:liuhan3@lenovo.com">HanL(liuhan3)</a>
 * on 2018/4/12 11:57
 */
public class SimpleTaskDuplicateChecker implements TaskDuplicateChecker {

    private final Set<Task> set = new ConcurrentHashSet<>();

    @Override
    public boolean isDuplicate(Task task) {
        return set.add(task);
    }
}
